
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>支付宝APP支付 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="alipay-notify.html" />
    
    
    <link rel="prev" href="alipay-transfer.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../../">
            
                <a href="../../../">
            
                    
                    项目导航
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../contact.html">
            
                <a href="../../contact.html">
            
                    
                    联系方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../../study.html">
            
                <a href="../../study.html">
            
                    
                    学习资料
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../../gitchat.html">
            
                <a href="../../gitchat.html">
            
                    
                    GitChat交流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../blog/">
            
                <a href="../../blog/">
            
                    
                    我的博客
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../../opensource/">
            
                <a href="../../opensource/">
            
                    
                    开源项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../../opensource/IJPay.html">
            
                <a href="../../opensource/IJPay.html">
            
                    
                    What is a IJPay?
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../../opensource/JPay.html">
            
                <a href="../../opensource/JPay.html">
            
                    
                    Android支付SDK-JPay
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../../opensource/weixin_guide.html">
            
                <a href="../../opensource/weixin_guide.html">
            
                    
                    极速开发微信公众号
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../">
            
                <a href="../">
            
                    
                    IJPay 文档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="./">
            
                <a href="./">
            
                    
                    支付宝支付
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1.1" data-path="alipay-config.html">
            
                <a href="alipay-config.html">
            
                    
                    配置应用环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.2" data-path="alipay-init.html">
            
                <a href="alipay-init.html">
            
                    
                    IJPay 支付宝初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.3" data-path="alipay-wap.html">
            
                <a href="alipay-wap.html">
            
                    
                    支付宝手机网站支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.4" data-path="alipay-pc.html">
            
                <a href="alipay-pc.html">
            
                    
                    支付宝电脑网站支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.5" data-path="alipay-offline.html">
            
                <a href="alipay-offline.html">
            
                    
                    当面付
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1.5.1" data-path="alipay-offline/alipay-qrPay.html">
            
                <a href="alipay-offline/alipay-qrPay.html">
            
                    
                    支付宝扫码支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.5.2" data-path="alipay-offline/alipay-barPay.html">
            
                <a href="alipay-offline/alipay-barPay.html">
            
                    
                    支付宝条码支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.5.3" data-path="alipay-offline/alipay-wavePay.html">
            
                <a href="alipay-offline/alipay-wavePay.html">
            
                    
                    支付宝声波支付
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.1.6" data-path="alipay-coupon.html">
            
                <a href="alipay-coupon.html">
            
                    
                    支付宝红包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.7" data-path="alipay-transfer.html">
            
                <a href="alipay-transfer.html">
            
                    
                    支付宝提现
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.7.1.8" data-path="alipay-app.html">
            
                <a href="alipay-app.html">
            
                    
                    支付宝APP支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.9" data-path="alipay-notify.html">
            
                <a href="alipay-notify.html">
            
                    
                    支付宝服务端异步通知
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.1.10" data-path="alipay-api.html">
            
                <a href="alipay-api.html">
            
                    
                    支付宝API字典
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../wxpay/">
            
                <a href="../wxpay/">
            
                    
                    微信支付
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.2.1" data-path="../wxpay/wxapi.html">
            
                <a href="../wxpay/wxapi.html">
            
                    
                    微信公用API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.2" data-path="../wxpay/allapi.html">
            
                <a href="../wxpay/allapi.html">
            
                    
                    微信支付API接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.3" data-path="../wxpay/micropay.html">
            
                <a href="../wxpay/micropay.html">
            
                    
                    微信刷卡支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.4" data-path="../wxpay/wechatPay.html">
            
                <a href="../wxpay/wechatPay.html">
            
                    
                    微信公众号支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.5" data-path="../wxpay/qrPay.html">
            
                <a href="../wxpay/qrPay.html">
            
                    
                    微信扫码支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.6" data-path="../wxpay/appPay.html">
            
                <a href="../wxpay/appPay.html">
            
                    
                    微信APP支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.7" data-path="../wxpay/H5.html">
            
                <a href="../wxpay/H5.html">
            
                    
                    微信H5支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.8" data-path="../wxpay/wxapp.html">
            
                <a href="../wxpay/wxapp.html">
            
                    
                    微信小程序支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.9" data-path="../wxpay/redpack.html">
            
                <a href="../wxpay/redpack.html">
            
                    
                    微信现金红包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.10" data-path="../wxpay/transfers.html">
            
                <a href="../wxpay/transfers.html">
            
                    
                    微信企业付款
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.11" data-path="../wxpay/refund.html">
            
                <a href="../wxpay/refund.html">
            
                    
                    微信退款
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2.12" data-path="../wxpay/wxpay-notify.html">
            
                <a href="../wxpay/wxpay-notify.html">
            
                    
                    服务端异步通知
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../.." >支付宝APP支付</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x652F;&#x4ED8;&#x5B9D;app&#x652F;&#x4ED8;">&#x652F;&#x4ED8;&#x5B9D;APP&#x652F;&#x4ED8;</h1>
<p>&#x76EE;&#x524D;&#x652F;&#x6301;&#x624B;&#x673A;&#x7CFB;&#x7EDF;&#x6709;&#xFF1A;iOS&#xFF08;&#x82F9;&#x679C;&#xFF09;&#x3001;Android&#xFF08;&#x5B89;&#x5353;&#xFF09;&#x3002;</p>
<h3 id="&#x5B98;&#x65B9;&#x63A5;&#x5165;&#x6587;&#x6863;">&#x5B98;&#x65B9;&#x63A5;&#x5165;&#x6587;&#x6863;</h3>
<p><a href="https://docs.open.alipay.com/204" target="_blank">https://docs.open.alipay.com/204</a></p>
<p>&#x53C2;&#x8003;&#x535A;&#x5BA2; <a href="http://blog.csdn.net/zyw_java/article/details/54024238" target="_blank">Android&#x7248;-&#x652F;&#x4ED8;&#x5B9D;APP&#x652F;&#x4ED8;</a></p>
<h3 id="ijpay-&#x63A5;&#x53E3;">IJPay &#x63A5;&#x53E3;</h3>
<pre><code>    /**
     * APP&#x652F;&#x4ED8;
     * @param model
     * @param notifyUrl
     * @return {String}
     * @throws {AlipayApiException}
     */
    public static String startAppPay(AlipayTradeAppPayModel model, String notifyUrl) throws AlipayApiException{
        AlipayTradeAppPayResponse response = appPayToResponse(model,notifyUrl);
        return response.getBody();
    }

    /**
     * APP&#x652F;&#x4ED8;
     * https://doc.open.alipay.com/docs/doc.htm?treeId=54&amp;articleId=106370&amp;docType=1
     * @param model
     * @param notifyUrl
     * @return {AlipayTradeAppPayResponse}
     * @throws {AlipayApiException}
     */
    public static AlipayTradeAppPayResponse appPayToResponse(AlipayTradeAppPayModel model, String notifyUrl) throws AlipayApiException{
        //&#x5B9E;&#x4F8B;&#x5316;&#x5177;&#x4F53;API&#x5BF9;&#x5E94;&#x7684;request&#x7C7B;,&#x7C7B;&#x540D;&#x79F0;&#x548C;&#x63A5;&#x53E3;&#x540D;&#x79F0;&#x5BF9;&#x5E94;,&#x5F53;&#x524D;&#x8C03;&#x7528;&#x63A5;&#x53E3;&#x540D;&#x79F0;&#xFF1A;alipay.trade.app.pay
        AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
        //SDK&#x5DF2;&#x7ECF;&#x5C01;&#x88C5;&#x6389;&#x4E86;&#x516C;&#x5171;&#x53C2;&#x6570;&#xFF0C;&#x8FD9;&#x91CC;&#x53EA;&#x9700;&#x8981;&#x4F20;&#x5165;&#x4E1A;&#x52A1;&#x53C2;&#x6570;&#x3002;&#x4EE5;&#x4E0B;&#x65B9;&#x6CD5;&#x4E3A;sdk&#x7684;model&#x5165;&#x53C2;&#x65B9;&#x5F0F;(model&#x548C;biz_content&#x540C;&#x65F6;&#x5B58;&#x5728;&#x7684;&#x60C5;&#x51B5;&#x4E0B;&#x53D6;biz_content)&#x3002;
        request.setBizModel(model);
        request.setNotifyUrl(notifyUrl);
        //&#x8FD9;&#x91CC;&#x548C;&#x666E;&#x901A;&#x7684;&#x63A5;&#x53E3;&#x8C03;&#x7528;&#x4E0D;&#x540C;&#xFF0C;&#x4F7F;&#x7528;&#x7684;&#x662F;sdkExecute
        AlipayTradeAppPayResponse response = AliPayApiConfigKit.getAliPayApiConfig().getAlipayClient().sdkExecute(request);
        return response;
    }

    /**
     * APP&#x652F;&#x4ED8;
     * @param model
     * @param notifyUrl
     * @return {AlipayTradeAppPayResponse}
     * @throws {AlipayApiException}
     */
    @Deprecated
    public static AlipayTradeAppPayResponse appPay(AlipayTradeAppPayModel model, String notifyUrl) throws AlipayApiException{
        return appPayToResponse(model, notifyUrl);
    }
</code></pre><h3 id="&#x670D;&#x52A1;&#x7AEF;&#x4EE3;&#x7801;&#x793A;&#x4F8B;">&#x670D;&#x52A1;&#x7AEF;&#x4EE3;&#x7801;&#x793A;&#x4F8B;</h3>
<p>&#x751F;&#x6210;&#x8BA2;&#x5355;&#x5E76;&#x8FD4;&#x56DE;&#x5524;&#x8D77;&#x5BA2;&#x6237;&#x7AEF;&#x652F;&#x4ED8;&#x7684;<code>orderInfo</code>,&#x5177;&#x4F53;&#x5B9E;&#x73B0;&#x5982;&#x4E0B;&#xFF1A;</p>
<p><a href="https://gitee.com/javen205/IJPay-Demo/blob/SpringBoot/src/main/java/com/ijpay/controller/alipay/AliPayController.java" target="_blank">Spring Boot&#x7248;&#x672C;Demo</a></p>
<pre><code>    /**
     * app&#x652F;&#x4ED8;
     */
    @RequestMapping(value = &quot;/appPay&quot;)
    @ResponseBody
    public AjaxResult appPay() {
        try {
            AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
            model.setBody(&quot;&#x6211;&#x662F;&#x6D4B;&#x8BD5;&#x6570;&#x636E;-By Javen&quot;);
            model.setSubject(&quot;App&#x652F;&#x4ED8;&#x6D4B;&#x8BD5;-By Javen&quot;);
            model.setOutTradeNo(StringUtils.getOutTradeNo());
            model.setTimeoutExpress(&quot;30m&quot;);
            model.setTotalAmount(&quot;0.01&quot;);
            model.setPassbackParams(&quot;callback params&quot;);
            model.setProductCode(&quot;QUICK_MSECURITY_PAY&quot;);
            String orderInfo = AliPayApi.startAppPay(model, aliPayBean.getDomain() + &quot;/alipay/notify_url&quot;);
            result.success(orderInfo);
        } catch (AlipayApiException e) {
            e.printStackTrace();
            result.addError(&quot;system error:&quot;+e.getMessage());
        }
        return result;
    }
</code></pre><p><a href="https://gitee.com/javen205/IJPay-Demo/blob/master/src/main/java/com/ijpay/controller/alipay/AliPayController.java" target="_blank">JFinal&#x7248;&#x672C;Demo</a></p>
<pre><code>    /**
     * app&#x652F;&#x4ED8;
     */
    public void appPay() {
        try {
            AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
            model.setBody(&quot;&#x6211;&#x662F;&#x6D4B;&#x8BD5;&#x6570;&#x636E;-By Javen&quot;);
            model.setSubject(&quot;App&#x652F;&#x4ED8;&#x6D4B;&#x8BD5;-By Javen&quot;);
            model.setOutTradeNo(StringUtils.getOutTradeNo());
            model.setTimeoutExpress(&quot;30m&quot;);
            model.setTotalAmount(&quot;0.01&quot;);
            model.setPassbackParams(&quot;callback params&quot;);
            model.setProductCode(&quot;QUICK_MSECURITY_PAY&quot;);
            String orderInfo = AliPayApi.startAppPay(model, notify_domain + &quot;/alipay/app_pay_notify&quot;);
            result.success(orderInfo);
            renderJson(result);

        } catch (AlipayApiException e) {
            e.printStackTrace();
            result.addError(&quot;system error&quot;);
        }
    }
</code></pre><h3 id="&#x5BA2;&#x6237;&#x7AEF;&#x5B9E;&#x73B0;">&#x5BA2;&#x6237;&#x7AEF;&#x5B9E;&#x73B0;</h3>
<p>&#x5B98;&#x65B9;<a href="https://docs.open.alipay.com/204/105296/" target="_blank">App&#x652F;&#x4ED8;Android&#x96C6;&#x6210;&#x6D41;&#x7A0B;</a>&#x8FD9;&#x91CC;&#x5C31;&#x4E0D;&#x505A;&#x8FC7;&#x591A;&#x89E3;&#x91CA;&#x4E86;&#xFF0C;&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x6765;&#x770B;&#x770B;&#x5982;&#x4F55;&#x4F7F;&#x7528;JPay&#x5FEB;&#x901F;&#x63A5;&#x5165;Android APP&#x652F;&#x4ED8;&#x3002;</p>
<p>&#x5BF9;&#x5FAE;&#x4FE1;App&#x652F;&#x4ED8;&#x3001;&#x652F;&#x4ED8;&#x5B9D;App&#x652F;&#x4ED8;&#x3001;&#x94F6;&#x8054;App&#x652F;&#x4ED8;&#x7684;&#x4E8C;&#x6B21;&#x5C01;&#x88C5;,&#x5BF9;&#x5916;&#x63D0;&#x4F9B;&#x4E00;&#x4E2A;&#x76F8;&#x5BF9;&#x7B80;&#x5355;&#x7684;&#x63A5;&#x53E3;&#x4EE5;&#x53CA;&#x652F;&#x4ED8;&#x7ED3;&#x679C;&#x7684;&#x56DE;&#x8C03;</p>
<p><a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank"><img src="https://img.shields.io/badge/license-Apache%202-green.svg" alt="License"></a>    <a href="https://jitpack.io/#javen205/JPay" target="_blank"><img src="https://jitpack.io/v/javen205/JPay.svg" alt=""></a>    <a href="http://blog.csdn.net/zyw_java" target="_blank"><img src="https://img.shields.io/badge/JPay%20OR%20IJPay%20Author-Javen-ff69b4.svg" alt="JPay Author"></a></p>
<p>GitHub:<a href="https://github.com/Javen205/JPay" target="_blank">https://github.com/Javen205/JPay</a></p>
<p>Gitee:<a href="http://gitee.com/Javen205/JPay" target="_blank">http://gitee.com/Javen205/JPay</a></p>
<p><strong>&#x4F7F;&#x7528;&#x65B9;&#x6CD5;</strong></p>
<h3 id="1&#x3001;&#x5750;&#x6807;">1&#x3001;&#x5750;&#x6807;</h3>
<p>Step 1. Add it in your root build.gradle at the end of repositories:</p>
<pre><code>    allprojects {
        repositories {
            ...
            maven { url &apos;https://jitpack.io&apos; }
        }
    }
</code></pre><p>Step 2. Add the dependency</p>
<pre><code>compile &apos;com.github.javen205.JPay:JPay:latest.release.here&apos;
</code></pre><p>&#x4F8B;&#x5982;&#xFF1A;&#x7248;&#x672C;&#x53F7;&#x4E3A;<code>0.0.4</code></p>
<pre><code>compile &apos;com.github.javen205.JPay:JPay:0.0.4&apos;
</code></pre><h3 id="2-android-manifest&#x914D;&#x7F6E;">2. Android Manifest&#x914D;&#x7F6E;</h3>
<h5 id="21&#x6743;&#x9650;&#x58F0;&#x660E;">2.1&#x6743;&#x9650;&#x58F0;&#x660E;</h5>
<pre><code>&lt;uses-permission android:name=&quot;android.permission.INTERNET&quot;/&gt;
&lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
&lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
&lt;uses-permission android:name=&quot;android.permission.READ_PHONE_STATE&quot; /&gt;
&lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
</code></pre><h5 id="22&#x6CE8;&#x518C;activity">2.2&#x6CE8;&#x518C;activity</h5>
<p><code>application</code>&#x8282;&#x70B9;&#x6DFB;&#x52A0;&#x5982;&#x4E0B;&#x7C7B;&#x5BB9;</p>
<pre><code>

        &lt;!-- &#x652F;&#x4ED8;&#x5B9D;&#x652F;&#x4ED8; --&gt;

        &lt;activity
            android:name=&quot;com.alipay.sdk.app.H5PayActivity&quot;
            android:configChanges=&quot;orientation|keyboardHidden|navigation|screenSize&quot;
            android:exported=&quot;false&quot;
            android:screenOrientation=&quot;behind&quot;
            android:windowSoftInputMode=&quot;adjustResize|stateHidden&quot; &gt;
        &lt;/activity&gt;
        &lt;activity
            android:name=&quot;com.alipay.sdk.app.H5AuthActivity&quot;
            android:configChanges=&quot;orientation|keyboardHidden|navigation&quot;
            android:exported=&quot;false&quot;
            android:screenOrientation=&quot;behind&quot;
            android:windowSoftInputMode=&quot;adjustResize|stateHidden&quot; &gt;
        &lt;/activity&gt;

        &lt;!-- &#x652F;&#x4ED8;&#x5B9D;&#x652F;&#x4ED8; end --&gt;
</code></pre><h3 id="3-&#x53D1;&#x8D77;&#x652F;&#x4ED8;">3. &#x53D1;&#x8D77;&#x652F;&#x4ED8;</h3>
<p>&#x5982;&#x9700;&#x5F00;&#x542F;&#x6D4B;&#x8BD5;&#x6A21;&#x5F0F;&#x53EA;&#x9700;&#x8981;&#x5728;OnCreate&#x4E2D;&#x6DFB;&#x52A0;&#x5982;&#x4E0B;&#x4EE3;&#x7801;&#x3002;&#x6C99;&#x7BB1;&#x73AF;&#x5883;&#x6D4B;&#x8BD5;APP&#x652F;&#x4ED8;&#x4E2D;&#x8BF7;&#x4F7F;&#x7528;&#x6C99;&#x7BB1;&#x7248;&#x94B1;&#x5305;&#x6D4B;&#x8BD5;</p>
<p><code>EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);</code></p>
<blockquote>
<p>&#x901A;&#x8FC7;&#x670D;&#x52A1;&#x7AEF;&#x63A5;&#x53E3;&#x83B7;&#x53D6;&#x5230;<code>orderInfo</code>&#x540E;&#x5524;&#x8D77;App&#x5BA2;&#x6237;&#x7AEF;&#x8FDB;&#x884C;&#x652F;&#x4ED8;</p>
</blockquote>
<pre><code>JPay.getIntance(mContext).toPay(JPay.PayMode.ALIPAY, orderInfo, new JPay.JPayListener() {
            @Override
            public void onPaySuccess() {
                Toast.makeText(mContext, &quot;&#x652F;&#x4ED8;&#x6210;&#x529F;&quot;, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onPayError(int error_code, String message) {
                Toast.makeText(mContext, &quot;&#x652F;&#x4ED8;&#x5931;&#x8D25;&gt;&quot;+error_code+&quot; &quot;+ message, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onPayCancel() {
                Toast.makeText(mContext, &quot;&#x53D6;&#x6D88;&#x4E86;&#x652F;&#x4ED8;&quot;, Toast.LENGTH_SHORT).show();
            }
        });
</code></pre><p>&#x6216;&#x8005;</p>
<pre><code>Alipay.getInstance(mContext).startAliPay(orderInfo, new JPay.JPayListener() {
            @Override
            public void onPaySuccess() {

            }

            @Override
            public void onPayError(int error_code, String message) {

            }

            @Override
            public void onPayCancel() {

            }
        });
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="alipay-transfer.html" class="navigation navigation-prev " aria-label="Previous page: 支付宝提现">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="alipay-notify.html" class="navigation navigation-next " aria-label="Next page: 支付宝服务端异步通知">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"支付宝APP支付","level":"1.7.1.8","depth":3,"next":{"title":"支付宝服务端异步通知","level":"1.7.1.9","depth":3,"path":"doc/ijpay/alipay/alipay-notify.md","ref":"doc/ijpay/alipay/alipay-notify.md","articles":[]},"previous":{"title":"支付宝提现","level":"1.7.1.7","depth":3,"path":"doc/ijpay/alipay/alipay-transfer.md","ref":"doc/ijpay/alipay/alipay-transfer.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"doc/ijpay/alipay/alipay-app.md","mtime":"2018-09-07T06:36:36.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-07T06:37:49.719Z"},"basePath":"../../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../../gitbook/gitbook.js"></script>
    <script src="../../../gitbook/theme.js"></script>
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

